import Validator from 'validatorjs';

/**
 * 
 * 一些登录的自定义规则
 */

Validator.register(
    'fundAccount',
    function (value, requirement, attribute) {
        console.log('fundAccount',value, requirement, attribute)
        return value.length >= 4 &&  value.length <= 10;
    },
    '资金账户长度为4-6位'
);


Validator.register(
    'phone_four',
    function (value, requirement, attribute) {
        return value.trim() !== '' && value.length === 4 ;
    },
    '需要的是4位手机尾号'
);

Validator.register(
    'phone_toal',
    function (value, requirement, attribute) {
        return /^1[3-9]\d{9}$/.test(value) ;
    },
    '手机号验证错误'
);

Validator.register(
    'idcarNumber',
    function (value, requirement, attribute) {
        return /^\d{17}[\dX]$/.test(value) ;
    },
    '身份证验证错误'
);



Validator.register(
    'validCode',
    function (value, requirement, attribute) {
        return  value.trim() !== ''
    },
    '短信验证码不能为空'
);